package cn.tedu.es.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;

/**
 * @author Amos
 * @date 2022/5/3
 * spring data es api, 可以根据这里的设置，自动创建索引
 * 一般应该手动创建索引，而不依赖于api自动创建
 */

@Document(indexName = "students", shards = 3, replicas = 2)
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Student {
    @Id
    private Long id;
    private String name;
    private Character gender;
    @Field("birthData") // 索引中的字段名，与类中的属性同名可以不写
    private String birthData;
}
